


console.log("fetchDataApi");


function getQueryString(name) {
    let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
    let r = window.location.search.substr(1).match(reg);
    if (r != null) {
        return r[2];
    };
    return 0;
 }

var auto_get = getQueryString("auto_get");
console.log(auto_get)
if ($("title").text().trim() === "Page Not Found") {
  // 页面不存在
  console.log("404 Page Error");

}else if(auto_get=="true"){

     setTimeout(() => {
         fetchDataApi();
      }, 2000);

}

function fetchDataApi(){
    console.log("fetchDataApi");
    var dataPro = {};
    var address = [];
    $("body").find(".a-row.a-spacing-none.indent-left").each(function(e){
        address.push($(this).find("span").html());
    })
    dataPro.address = address;//图片
    dataPro.seller_name = getQueryString("seller_name");
    console.log(dataPro);
    $.post("https://www.gongrenbao.cn/index.php?c=api/ozon/updateseller",
          {dataPro:dataPro},
          function(data){
            console.log(data);
          },
      "text");

}
